/**
 * 
 */
package acmCoder.xiaomi;

import java.util.Scanner;

/**
 * @author zhongfang
 *
 */
public class 序列模式匹配 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		while (scanner.hasNext()) {
			String[] total = scanner.nextLine().split(" ");
			String text = total[0];
			String pattern = total[1];
			int n = text.length();
			int m = pattern.length();
			if (n < m) {
				System.out.println(-1);
				continue;
			}
			// int[] patternFreq = new int[26];
			// for (int i = 0; i < m; i++) {
			// patternFreq[pattern.charAt(i) - 'a']++;
			// }
			int res = Integer.MAX_VALUE;
			int start = -1;
			int end = -1;
			for (int i = 0; i < n; i++) {
				if (text.charAt(i) == pattern.charAt(0)) {// 对比
					int textIndex = i + 1;
					int pattIndex = 1;
					while (textIndex != n && pattIndex != m) {
						if (text.charAt(textIndex) == pattern.charAt(pattIndex)) {
							textIndex++;
							pattIndex++;
						} else {
							textIndex++;
						}
					}
					if (pattIndex == m) {
						int len = textIndex - i;
						if (res > len) {
							res = len;
							start = i;
							end = textIndex - 1;
						}
					}
				}
			} // end for
			System.out.println(start + " " + end);
		}
	}

}
